import React, { useRef, useState } from 'react';
import ChildComponent, { RefProps } from './component/ChildComponent';

function App() {
  const childRef = useRef<RefProps>(null);
  const handleClick = () => {
    childRef.current?.chileMethod();
  }

  return (
    <div>
      <ChildComponent ref={childRef} />
      <button onClick={handleClick}>调用子组件方法</button>
    </div>
  );
}

export default App;
